import { Entity, PrimaryGeneratedColumn, Column, OneToMany, ManyToMany } from "typeorm";

import {RoleEntity} from './../role/role.entity'
@Entity({name:'tyk_menu'})
export class MenuEntity{
    @PrimaryGeneratedColumn({name:'menu_id'})
    menuId:number

    @Column({comment:'菜单名称',name:'menu_name'})
    menuName:string

    @Column({comment:'父菜单id（默认为0）',name:'parent_id',default:0})
    parentId:number

    @Column({comment:'菜单标识，前端路由'})
    code:string

    @Column({name:'menu_type',comment:'菜单类型，1目录（不跳转），2菜单（跳转），3按钮',default:1})
    menuType:number

    @Column({name:'order_num',comment:'排序'})
    orderNum:number

    @Column({ type: 'varchar', comment: '权限标识，接口标识', default: null })
    public perms: string

    @ManyToMany(
        type=>RoleEntity,
        role=>role.menus,
    )
    roles:RoleEntity[]
}